package yz.mr.MapJoin;
import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class MapStudent implements Writable {
    //1500100001	施笑槐,22,女,文科六班,406 获取一行数据
    String id;
    String name;
    String age;
    String sex;
    String clazz;
    int score;

    public MapStudent() {
    }

    public MapStudent(String id, String name, String age, String sex, String clazz, int score) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.clazz = clazz;
        this.score = score;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getClazz() {
        return clazz;
    }

    public void setClazz(String clazz) {
        this.clazz = clazz;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    @Override
    public String toString() {
        return "student{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", age='" + age + '\'' +
                ", sex='" + sex + '\'' +
                ", clazz='" + clazz + '\'' +
                ", score=" + score +
                '}';
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeUTF(this.id);
        out.writeUTF(this.name);
        out.writeUTF(this.age);
        out.writeUTF(this.sex);
        out.writeUTF(this.clazz);
        out.writeInt(this.score);

    }

    @Override
    public void readFields(DataInput in) throws IOException {

        this.id = in.readUTF();
        this.name = in.readUTF();
        this.age = in.readUTF();
        this.sex = in.readUTF();
        this.clazz = in.readUTF();
        this.score = in.readInt();
    }
}

